package com.hsh.server;

import lombok.Value;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.HashMap;
import java.util.Map;

@SpringBootApplication
@MapperScan("com.hsh.server.project.**.mapper")
@Slf4j
public class MusicHistoryAppApplication {




    public static void main(String[] args) {
        SpringApplication.run(MusicHistoryAppApplication.class, args);
        // 定义字母图案的映射
        Map<Character, String[]> letterPatterns = new HashMap<>();
        letterPatterns.put('H', new String[]{"H-H-", "H-H-", "HHH-", "H-H-", "H-H-"});
        letterPatterns.put('S', new String[]{"S-S-", "S---", "S-S-", "---S", "S-S-"});
        // 可以添加更多字母的定义

        // 定义要打印的单词
        String word = "HSH";

        // 找到所有字母的最大行数
        int maxLines = 0;
        for (char c : word.toCharArray()) {
            String[] lines = letterPatterns.getOrDefault(c, new String[]{"----"});
            if (lines.length > maxLines) {
                maxLines = lines.length;
            }
        }

        // 逐行打印
        for (int i = 0; i < maxLines; i++) {
            StringBuilder lineBuilder = new StringBuilder();
            for (char c : word.toCharArray()) {
                String[] lines = letterPatterns.getOrDefault(c, new String[]{"----"});
                if (i < lines.length) {
                    lineBuilder.append(lines[i]);
                } else {
                    lineBuilder.append("----"); // 填充空格
                }
                lineBuilder.append("-"); // 字母之间用 "-" 分隔
            }
            // 移除最后一个多余的 "-"
            String line = lineBuilder.toString().replaceAll("-$", "");
            System.out.println(line);
        }
    }

}
